
import java.util.ArrayList;
import java.util.regex.Pattern;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author 500384
 */
public class Illumination {
    /*
     * hente data fra database/XML
     * velge hvilke lamper som skal bruke energi basert på sliderdata
     * regne ut hvor mye energi som blir brukt pr time og pr døgn
     * sende energi
    */
    
    private static int numberOfLights;
    private static double kwPrHour;  
    
    public static int getNumberOfLights() {
        return numberOfLights;
    }

    public static void setNumberOfLights(int numberOfLights) {
        Illumination.numberOfLights = numberOfLights;
    }

    public static double getKwPrHour() {
        return kwPrHour;
    }

    public static void setKwPrHour(double kwPrHour) {
        Illumination.kwPrHour = kwPrHour;
    }
    
    //default constructor for this object
    public Illumination () { }
    
    //constructor which instantiates an object with the required fields number of lights and the electrical usage for an average light unit
    public Illumination(int numberOfLights, double kwPrHour) {
        this.numberOfLights = numberOfLights;
        this.kwPrHour = kwPrHour;
    }
    
    //calculates the total electrical consumption of a building when all lights are powered on
    public static double MaximumUsage() {       
        double watt = kwPrHour / 1000;
        double energyInKw = numberOfLights * watt;
        return energyInKw;
    }
    
    //returns an array of numbers representing the hour-by-hour consumption of the building
    public static void CalculateUsage() {
        String pattern = "0, 0.5, 0.5, 1, 1, 1, 1, 0.5, 0.5, 0, 0";
        pattern = pattern.replaceAll("\\s", "");
        String[] array = pattern.split(",");
        
        for(int i = 0; i < array.length; i++)
        {
            double out = Double.parseDouble(array[i]) * MaximumUsage();
            System.out.println(out + "");
        }
    }
    
    public static void main(String []args) {
        //System.out.println("Energiforbruk i kW-timer: " + CalculateEnergyUsage());
        /*int maxForbruk = 500000;
        String s = "12.5, 56.7, 89.3";
        s = s.replaceAll("\\s", "");
        String[] a = s.split(",");
        
        for(int i = 0; i < a.length; i++)
        {
            double out = Double.parseDouble(a[i]) * maxForbruk / 100;
            System.out.println(out + "");
        }
        * */
        CalculateUsage();
    }
    
}